package com.clutch.student;
/**
 * 修改个人信息界面
 */

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import com.clutch.student.Adapter.StudentAdapter;
import com.clutch.student.Dao.StudentDao;
import com.clutch.student.Entity.Student_info;

import java.util.List;


public class ThirdRragment2Activity extends AppCompatActivity{

    Button btn;
    ImageView back_btn;
    Context context = MyApplication.getInstance();
    private StudentDao student = new StudentDao(context);
    private List<Student_info> StudentList = student.getStudent(MainActivity.getStudentId());
    private int studentId = MainActivity.getStudentId();
    private RecyclerView recyclerView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_third);

        //返回
        back_btn = findViewById(R.id.back_btn);
        back_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        //绑定适配器
        recyclerView = findViewById(R.id.recycler_view);
        StudentAdapter adapter = new StudentAdapter(StudentList);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        recyclerView.setLayoutManager(layoutManager);

        //为RecyclerView中的每一项加分割线
        DividerItemDecoration mDividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),layoutManager.getOrientation());
        recyclerView.addItemDecoration(mDividerItemDecoration);
        recyclerView.setAdapter(adapter);



        btn = (Button) findViewById(R.id.click);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(ThirdRragment2Activity.this, StudentChangeActivity.class);
                startActivity(intent);
            }
        });
    }

}




